home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMainSave
- BorderStyle = 3 'Fixed Double
- Caption = "Save"
- ClientHeight = 4095
- ClientLeft = 2340
- ClientTop = 2280
- ClientWidth = 5025
- ClipControls = 0 'False
- ControlBox = 0 'False
- Height = 4500
- Left = 2280
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4095
- ScaleWidth = 5025
- Top = 1935
- Width = 5145
- Begin CommandButton cmdSave
- Caption = "&SAVE"
- Default = -1 'True
- Height = 420
- Left = 600
- TabIndex = 4
- Top = 3510
- Width = 990
- End
- Begin CommandButton cmdDontSave
- Caption = "&DON'T SAVE"
- Height = 420
- Left = 1800
- TabIndex = 5
- Top = 3510
- Width = 1365
- End
- Begin OptionButton optChoice
- Caption = "BUTTON to BITMAP then BITMAP to DISK"
- Height = 330
- Index = 8
- Left = 525
- TabIndex = 3
- Top = 2700
- Visible = 0 'False
- Width = 4065
- End
- Begin OptionButton optChoice
- Caption = "MASTER BITMAP to DISK"
- Height = 330
- Index = 4
- Left = 525
- TabIndex = 2
- Top = 2160
- Visible = 0 'False
- Width = 4215
- End
- Begin OptionButton optChoice
- Caption = "BUTTON to MASTER BITMAP"
- Height = 330
- Index = 2
- Left = 525
- TabIndex = 1
- Top = 1665
- Visible = 0 'False
- Width = 4215
- End
- Begin OptionButton optChoice
- Caption = "BUTTON to DISK"
- Height = 375
- Index = 1
- Left = 525
- TabIndex = 0
- Top = 1170
- Visible = 0 'False
- Width = 3840
- End
- Begin CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "CANCEL"
- Height = 420
- Left = 3375
- TabIndex = 7
- Top = 3510
- Width = 990
- End
- Begin Label Label1
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = -1 'True
- ForeColor = &H00008000&
- Height = 735
- Left = 825
- TabIndex = 6
- Top = 225
- Width = 3240
- End
- Option Explicit
- Dim Selection As Integer
- Sub cmdCancel_Click ()
- frmMainSave.Tag = CANCEL_SAVE
- frmMainSave.Hide
- End Sub
- Sub cmdDontSave_Click ()
- Select Case frmMainSave.Tag
- Case 3, 9, 13
- ButtonChanged = False
- Case 4, 13
- BitMap.Changed = False
- End Select
- frmMainSave.Tag = NOT_SAVED
- frmMainSave.Hide
- End Sub
- Sub cmdSave_Click ()
- Dim z As Integer
- Select Case Selection
- Case 1 'Save individual buttons to disk
- Save_To_Disk S_TYPE_INDIVIDUAL
- Case 2 'Save buttons to the master bitmap
- If BitMap.Buttons = False Then 'No bitmap initialized
- frmSaveBit.Show 1
- End If
- If BitMap.Buttons > 0 Then 'Bitmap initialized
- Save_To_BitMap
- frmMainSave.Tag = SAVED
- Else
- frmMainSave.Tag = CANCEL_SAVE
- End If
- Case 4 'Save the master bitmap to disk
- Save_To_Disk S_TYPE_BITMAP
- Case 8 'Save the button to the master bitmap then save the master bitmap
- If BitMap.Buttons = False Then 'No bitmap initialized
- frmSaveBit.Show 1
- End If
- If BitMap.Buttons > 0 Then 'Bitmap initialized
- Save_To_BitMap
- frmMainSave.Tag = SAVED
- Save_To_Disk S_TYPE_BITMAP
- Else
- frmMainSave.Tag = CANCEL_SAVE
- End If
- Case Else
- MsgBox "Nothing selected"
- Exit Sub
- End Select
- frmMainSave.Hide
- End Sub
- Sub Form_Activate ()
- Dim n As Integer
- For n = 0 To 3
- optChoice(2 ^ n).Visible = (frmMainSave.Tag And (2 ^ n)) > 0
- If Not optChoice(2 ^ n).Visible Then optChoice(2 ^ n) = False
- Next n
- If Selection > 0 Then
- If Not optChoice(Selection).Visible Then Selection = False
- End If
- Select Case frmMainSave.Tag
- Case 3: Label1 = BUT_CHANGED & SAVE_CHANGES
- Case 4: Label1 = BIT_CHANGED & SAVE_CHANGES
- Case 9: Label1 = BUT_CHANGED & SAVE_CHANGES
- Case 13: Label1 = BOTH_CHANGED & SAVE_CHANGES
- Case Else
- Label1 = "Please select an option."
- End Select
- HelpItem = 12
- End Sub
- Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
- If KeyCode = &H70 Then
- Cheap_Help Format$(HelpItem)
- End If
- End Sub
- Sub Form_Load ()
- Position_Form frmMainSave
- KeyPreview = True
- End Sub
- Sub optChoice_Click (Index As Integer)
- Selection = Index
- End Sub
- Sub optChoice_DblClick (Index As Integer)
- Selection = Index
- cmdSave_Click
- End Sub
- Sub Save_To_BitMap ()
- Dim n As Integer
- Dim TempBox() As picturebox
- Dim NumButtons As Integer
- Dim Edge
- Dim Gap
- Dim FrameHeight As Integer
- 'Height of the picturebox top border + bottom border in pixels
- FrameHeight = GetSystemMetrics(SM_CYBORDER) * 2
- 'eg
- 'If the border is 1 then the edge of the master bitmap will be 1
- 'and the gap between buttons on the bitmap will be 2
- Edge = BitMap.Border
- Gap = BitMap.Border * 2
- 'If the disabled button is to be saved then update it
- If BitMap.Buttons And 4 Then Update_Button
- 'Allow for the top border of the bitmap
- If BitMap.Position = 0 Then BitMap.Position = BitMap.Border
- 'Find out how many buttons to save and redim TempBox to hold them
- For n = 0 To 2
- If BitMap.Buttons And (2 ^ n) Then NumButtons = NumButtons + 1
- Next n
- ReDim TempBox(NumButtons - 1)
- 'Reset NumButtons to zero so we can use it again
- NumButtons = 0
- For n = 0 To 2
- If BitMap.Buttons And 2 ^ n Then
- Set TempBox(NumButtons) = B(n)
- NumButtons = NumButtons + 1
- End If
- Next n
- 'Adjust the height of the master bitmap to hold the new button
- frmBitMap!picBitMap.Height = BitMap.Position + BitMap.ButtonHeight + Gap + FrameHeight
- 'Copy the buttons
- For n = 0 To UBound(TempBox)
- BitBlt frmBitMap!picBitMap.hDC, Edge + (BitMap.ButtonWidth * n) + (Gap * n), BitMap.Position, Edge + (BitMap.ButtonWidth * (n + 1)) + (Gap * n), Edge + BitMap.ButtonHeight, TempBox(n).hDC, 0, 0, SRCCOPY
- Next n
- 'save the position for the next button
- BitMap.Position = BitMap.Position + BitMap.ButtonHeight + Gap
- 'Change the flags
- BitMap.Changed = True
- ButtonChanged = False
- BitMapLoaded = True
- Editing = False
- End Sub
- Sub Save_To_Disk (sType As Integer)
- frmSave.Tag = sType
- frmSave.Show 1
- frmMainSave.Tag = frmSave.Tag 'Let the calling form know what's happened
- If frmMainSave.Tag = NOT_SAVED Then cmdDontSave_Click
- Unload frmSave
- End Sub
-